#include<bits/stdc++.h>
#define int long long
#define il inline
#define ct const
#define dl double
#define pk push_back
#define fi first
#define se second
#define pii pair<int,int>
#define N 2010
using namespace std;
il int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-') f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<1)+(x<<3)+(ch^48);ch=getchar();
	}
	return x*f;
}
char f__[40];
il void write(int x){
	int cnt=0;
	if(x<0){
		putchar('-');x=-x;
	}
	if(!x) putchar('0');
	while(x){
		f__[cnt++]=x%10+'0';x/=10;
	}
	while(cnt) putchar(f__[--cnt]);
}
int n,L,a[N],b[N],dp[N][N];
signed main(){
	freopen("lock.in","r",stdin);
	freopen("lock.out","w",stdout);
    n=read();L=read();
    for(int i=1;i<=n;++i){
        a[i]=read();b[i]=read();
    }
    if(n<=18){
        int ans=0;
        for(int j=1;j<(1<<(n+1));++j){
            int A=0,B=0;
            for(int k=1;k<=n;++k) if((1<<k)&j){
                A^=a[k];B^=b[k];
            }
            if(A<=L) ans=max(ans,B);
        }
        write(ans);
    }
	return 0;
}